package com.lmk.homework.work01;

import com.lmk.t4.Parent;

/**
 *
 */
public class Account {
    private int id;//id
   protected double balance;//余额
    private double annualInterestRate;//年利率

    public Account(int id, double balance, double annualInterestRate) {
        this.id = id;
        this.balance = balance;
        this.annualInterestRate = annualInterestRate;
    }

    /**
     * 月利率
     */

    /**
     * 存款
     * @param account
     */
    public void withdraw(double account){
        this.balance+=account;
        System.out.println("您存入总余额为"+balance);
        this.annualInterestRate/=12;
        System.out.println("您的月利率为："+annualInterestRate);
    }

    /**
     * 取款
     * @param account
     */
    public void  deposit(double account){
        if(this.balance<account){
            System.out.println("余额不足");
            System.out.println("您的余额为"+balance);
            return;
        } else {
            this.balance -= account;
            System.out.println("取出" + account + "剩余" + balance);
        }
    }
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    public double getAnnualInterestRate() {
        return annualInterestRate;
    }

    public void setAnnualInterestRate(double annualInterestRate) {
        this.annualInterestRate = annualInterestRate;
    }
}
